package org.spiderflow.core.model;

import java.util.StringJoiner;

/**
 * @author zhaoshihao
 * @version 2021/10/28 16:59
 */
public class LoopParam {
    private boolean isLoop;
    /**
     * 循环次数默认为1,如果节点有循环属性且填了循环次数/集合,则取出循环次数
     */
    private int loopCount = 1;
    /**
     * 循环起始位置
     */
    private int loopStart = 0;
    /**
     * 循环结束位置
     */
    private int loopEnd = 1;
    /**
     *
     */
    private Object loopArray;

    public LoopParam(boolean isLoop) {
        this.isLoop = isLoop;
    }

    public int getLoopCount() {
        return loopCount;
    }

    public LoopParam setLoopCount(int loopCount) {
        this.loopCount = loopCount;
        return this;
    }

    public int getLoopStart() {
        return loopStart;
    }

    public LoopParam setLoopStart(int loopStart) {
        this.loopStart = loopStart;
        return this;
    }

    public int getLoopEnd() {
        return loopEnd;
    }

    public LoopParam setLoopEnd(int loopEnd) {
        this.loopEnd = loopEnd;
        return this;
    }

    public Object getLoopArray() {
        return loopArray;
    }

    public LoopParam setLoopArray(Object loopArray) {
        this.loopArray = loopArray;
        return this;
    }

    public boolean isLoop() {
        return isLoop;
    }

    public LoopParam setLoop(boolean loop) {
        isLoop = loop;
        return this;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", LoopParam.class.getSimpleName() + "[", "]")
                .add("isLoop=" + isLoop)
                .add("loopCount=" + loopCount)
                .add("loopStart=" + loopStart)
                .add("loopEnd=" + loopEnd)
                .add("loopArray=" + loopArray)
                .toString();
    }
}
